/**
 * 
 */
package com.demo.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.demo.bean.Info;
import com.demo.dao.BaseDAO;
import com.demo.dao.CityDataDAO;

/**
 * @author Issac
 *
 */
@Repository
public class CityDataDAOImpl extends BaseDAO implements CityDataDAO {

	/* (non-Javadoc)
	 * @see com.demo.dao.CityDataDAO#addCityData(com.demo.bean.Info)
	 */
	public int addCityData(Info info) {
		return 0;
	}

	private static final String searchIndex = "select a " +
												 " from Info a where a.data_type = ? and a.data_position = ? " +
												   " order by a.updateTime desc";
	public List<Info> searchIndex(String searchType, String searchPosition,
			int currentPage, int pageSize) {
		return (List<Info>)executeQuery(searchIndex, pageSize*currentPage-pageSize, pageSize, 
				new Object[]{searchType, searchPosition});
	}

	private static final String searchIndexCount = "select count(*) from Info where data_type = ? and data_position = ? " +
														" order by updateTime desc";
	public Long searchIndexCount(String searchType, String searchPosition) {
		return (Long)this.uniqueResult(searchIndexCount, new Object[]{searchType, searchPosition});
	}
	

}
